package org.springblade.account.controller;

import org.checkerframework.checker.units.qual.C;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springblade.core.tool.api.R;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/api")
public class AccountController {

	private static final Logger log = LoggerFactory.getLogger(AccountController.class);

	@GetMapping("/account")
//	@PreAuth(value = "hasRole('user')")
//	@PreAuth(RoleConstant.HAS_ROLE_USER)
	@Cacheable(cacheNames = "blade-account")
	public R<String> account() {
		log.info("进入了方法:account");
		return R.data("account");
	}

	@GetMapping("/updateAccount")
	public R<String> updateAccount() {
		cleanCaches();
		log.info("进入了方法:updateAccount");
		return R.data("updateAccount");
	}

	@CacheEvict(cacheNames = "blade-account")
	@GetMapping
	public void cleanCaches() {
	}
}
